﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Tutorial_Test
{
    public partial class Form1 : Form
    {


        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            decimal a = numericUpDown1.Value + numericUpDown2.Value;
            textBox3.Text = a.ToString();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            decimal a = numericUpDown1.Value + numericUpDown2.Value;
            textBox3.Text = a.ToString();
            label5.Text = "Calculated " + numericUpDown1.Value + " plus " + numericUpDown2.Value + "!";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            decimal a = numericUpDown1.Value - numericUpDown2.Value;
            textBox3.Text = a.ToString();
            label5.Text = "Calculated " + numericUpDown1.Value + " minus " + numericUpDown2.Value + "!";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            decimal a = numericUpDown1.Value * numericUpDown2.Value;
            textBox3.Text = a.ToString();
            label5.Text = "Calculated " + numericUpDown1.Value + " times " + numericUpDown2.Value + "!";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            decimal alt = numericUpDown2.Value;
            if (alt == 0)
            {
                textBox3.Text = "ERROR!";
                label5.Text = "Calculation failed! You cannot divide by zero!";
            }
            else
            {
                decimal a = numericUpDown1.Value / numericUpDown2.Value;
                textBox3.Text = a.ToString();
                label5.Text = "Calculated " + numericUpDown1.Value + " divided by " + numericUpDown2.Value + "!";
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
